import { get, post, put, deletes } from "@/utils/request";
import api from "./resource";
//新增角色
export function addRole(data) {
  return post(api.roles, data, true).then(res => {
    if (res.success) return res.data;
  });
}

//修改角色信息
export function updateRole(id, data) {
  return put(api.roles + `/${id}`, data, true).then(res => {
    if (res.success) return res.data;
  });
}
//查询角色
export function getRoleList(query) {
  return get(api.roles, query, true).then(res => {
    if (res.success) return res.data;
  });
}
//查看角色详情
export function getRoleListDetail(id) {
  return get(api.roles + `/${id}`, "", true).then(res => {
    if (res.success) return res.data;
  });
}
//删除角色
export function deleteRole(id) {
  return deletes(api.roles + `/${id}`, "", true).then(res => {
    if (res.success) return res.data;
  });
}
//查看安全等级
export function securityLevel() {
  return get(api.securityLevel, "", true).then(res => {
    if (res.success) return res.data;
  });
}

//获取主题分类
export function getSubjects() {
  return get(window.ENV.API_USER+"/v1/selectZtdxApi", "", true).then(res => {
    if (res.success) return res.data;
  });
}

//获取标识符
export function getBfsInfo(currentPage,pageSize,data) {
  return post(window.ENV.API_USER+"/v1/selectBSF/" +`${currentPage}/${pageSize}`, data,true).then(res => {
    if (res.success) return res.data;
  });
}
// //获取主题分类
// export function getSubjects() {
//   return get(api.datasource+"/caccess/selectZtdxApi", "", true).then(res => {
//     if (res.success) return res.data;
//   });
// }

// //获取标识符
// export function getBfsInfo(currentPage,pageSize,data) {
//   return post(api.datasource+"/caccess/selectBSF/" +`${currentPage}/${pageSize}`, data,true).then(res => {
//     if (res.success) return res.data;
//   });
// }
//新增或者修改当前用户的脱敏信息
export function addUserDesensitize(data) {
  return post(api.userctrol+"/v1/userout/addUserDesensitize", data,true).then(res => {
    if (res.success) return res.data;
  });
}

//获取脱敏信息
export function getUserDesensitize(roleId) {
  return get(api.userctrol+"/v1/userout/getUserDesensitize/"+`${roleId}`, "",true).then(res => {
    if (res.success) return res.data;
  });
}


